package com.static_;

/**
 * @Author 小闽
 * @Date 2024/9/5 11:04
 * @PackageName: com.static_
 * @ClassName: StaticMethod
 * @Description: 类方法
 * @Version
 */
public class StaticMethod {
    public static void main(String[] args) {
        // 创建一个student1学生用于交费
        Student student1 = new Student("小明");
        student1.payFee(100);
        // 创建第二个student2学生交学费
        Student student2 = new Student("小红");
        student2.payFee(200);
        // 显示总共的学费信息
        Student.payPrint();
    }
}

class Student {
    // 姓名
    private String name;
    // 学费
    private static int StuFee;

    /**
     * 构造方法
     * @param name
     */
    public Student(String name) {
        this.name = name;
    }
    public static void payFee(double Fee){
        StuFee += Fee;
    }
    public static void payPrint(){
        System.out.println("学费为：" + Student.StuFee);
    }
}
